<?php $this->load->view('inc/header.php');?>
<?php $this->load->view('data/inc_sm.php');?>

<div class="col-right">

	<div class="box">
		<div class="box-t">
			<span class="fl">添加数据</span>	
			<span class="fr">
				<?php html_select($opt_model,fd('mid'),'id="slt-model"','--选择模型--');?>
			</span>
		</div>
		<div class="box-c" id="cat-tree">
			<?php if(!empty($mid)):?>
			<form id="frm-data-add" action="<?php echo site_url('c=data&m=add_do');?>" vdt="true">
			<table class="tbl-info">

				<tr>	
					<th width="150">
						类别：
					</th>
					<td>
						<?php html_select(fd('opt_cat'),0,'name="cid"','--请选择--');?>
					</td>
				</tr>

				<?php foreach ($attr as $k => $v):?>
				<?php if($v['add_hidden'] == '1') continue;?>
				<tr>	
					<th width="150">
						<?php echo $v['title'];?>：			
					</th>
					<td>
						<?php html_attr_view($v);?>					
					</td>
				</tr>
				<?php endforeach;?>
			</table>

			<div class="action">
				<input type="button" value="保存"  class="btn-ajax-submit" frmid="frm-data-add"/>
			</div>

			</form>
			<?php else:?>
				<div>请选择模型先！</div>
			<?php endif;?>
		</div>
	</div>

</div>

<?php $this->load->view('inc/footer.php');?>

<script type="text/javascript">$(function(){

	$('#slt-model').change(function(){
		var mid = $(this).val();
		var url = '<?php echo site_url("c=model&m=set_mid&mid=");?>'+mid;
		$.ajax({
			type: 'get',
			url: url,
			async: false,
			dataType:'json',
			success:function(msg){
	    		ajax_back(msg);
			}
		});		
	});

});</script>
